#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int singleNumber(vector<int>& nums) {
        int ret = 0;
        for (int i = 0; i < 32; i++)
        {
            int sum = 0;
            for (auto z : nums)
                if (((z >> i) & 1) == 1)
                    sum++;
            if ((sum % 3) == 1)
            {
                ret |= (1 << i);
                cout << ret << endl;
            }

        }
        return ret;
    }
};